//
// LibGraphic_sfml.hh for nibbler in /home/lefebv_w//workspace/cpp/nibbler/v1
// 
// Made by damien lefebvre
// Login   <lefebv_w@epitech.net>
// 
// Started on  Tue Mar 12 17:15:54 2013 damien lefebvre
// Last update Sun Mar 24 18:05:36 2013 damien lefebvre
//

#ifndef		__LIBGRAPHIC_SFML_HH__
#define		__LIBGRAPHIC_SFML_HH__

#include	<SFML/System.hpp>
#include        <SFML/Graphics.hpp>
#include        <SFML/Window.hpp>

#include	<string>
#include	<vector>
#include	<iostream>

#include	"IGraphicLibrary.hh"

class		LibGraphic_SFML : public IGraphicLibrary
{
public :
  class PictureOfElement
  {
  private :
    std::string				m_path;
    IGraphicLibrary::e_ListOfImage	m_type;
    sf::Image				m_image;

  public :
    PictureOfElement(std::string const & path, IGraphicLibrary::e_ListOfImage type);
    bool				isThatType(IGraphicLibrary::e_ListOfImage type) const;
    sf::Image const &			getImage(void) const;
    IGraphicLibrary::e_ListOfImage	getType(void) const;
  };


public :
  LibGraphic_SFML(unsigned int const size_x, unsigned int const size_y, std::vector<IGraphicLibrary::InfoPicture> const & listOfPictures);

  virtual void	refreshScreen(void);
  virtual void	draw(unsigned int const x, unsigned int const y, IGraphicLibrary::e_ListOfImage const e, IGraphicLibrary::e_Direction const dir = IGraphicLibrary::UP);
  virtual IGraphicLibrary::e_TypeOfEvent	checkEvent(void);
  virtual void	draw_footer(unsigned int const x, unsigned int const y, std::string const & str);

private :
  sf::RenderWindow		m_graph;
  unsigned int			m_size_x;
  unsigned int			m_size_y;
  unsigned int			m_compteur;
  std::vector<PictureOfElement>	m_pictures;

  unsigned int			find_image(IGraphicLibrary::e_ListOfImage e);
};

#endif
